import { IsNotEmpty, IsNumber, IsString, Length, MaxLength, ValidateIf } from 'class-validator'
import { PhoneDto } from '../index.dto'

export class LoginDTO extends PhoneDto {
    @Length(6, 6, { message: '请输入六位验证码！' })
    smsCode: string

    @MaxLength(128, { message: '设备ID最大支持128位！' })
    @IsNotEmpty({ message: '设备ID不能为空！' })
    devid: string

    @MaxLength(512, { message: '手机型号最大支持512位！' })
    @IsNotEmpty({ message: '手机型号不能为空！' })
    devName: string
}
export class GetOneDto {
    @ValidateIf((o) => !o.phone)
    @IsNotEmpty({ message: '用户ID和手机号最少传递一个！' })
    userid: string

    @ValidateIf((o) => !o.userid)
    @IsNotEmpty({ message: '用户ID和手机号最少传递一个！' })
    phone: string
}
